package com.tm1cobi.sendmail;

import com.tm1cobi.sendmail.sender.MailSender;

public class Main {

    public static void main(String[] args) {
        if (args.length == 5 || args.length == 6) {
            try {
                String host = args[0];
                String port = "25";
                String username = args[1];
                String password = args.length == 6 ? args[5] : "";

                String addresses = args[2];
                String title = args[3];
                String content = args[4];
                //

                new MailSender(host, port, username, password, addresses, title, content).send();
                //
            }
            catch (Exception e) {
                System.err.print(e.getMessage());
            }
        }
        else {
            System.out
                    .print("usage: java -jar sendmail.jar host senderaddress recvaddresses title contentpath password");
            return;
        }
    }
}
